package com.distribute.framework.model;

import com.distribute.framework.core.web.helper.Utils;
import java.lang.reflect.Field;
import java.util.Date; 
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;

import javax.annotation.Resource;

import com.distribute.framework.core.web.util.Page;
import com.distribute.framework.core.lang.*; 
import com.distribute.framework.core.web.helper.WebHelper.LzMap;
import com.distribute.framework.core.util.Function;
import com.distribute.framework.core.util.IbatisMap;
import com.distribute.framework.config.*;
import com.distribute.framework.plugin.*;

@namespace("users/shoppingcart")
public @caption("购物车") @database(DatabaseNames.distribute_sys) @source("distribute_sys") @table("shopping_cart") class ShoppingCart implements java.io.Serializable
{
	private static final long serialVersionUID = 1l;
	private @caption("编号") @column("id")    @primary  @notnull  @note("  ") Long id;// 主键 非空     
	private @caption("商品信息") @column("goods")      @note("  ") Long goods;//     
	private @caption("商品名称") @column("names")      @note("  ") String names;//     
	private @caption("价格") @column("price")      @note("  ") Double price;//     
	private @caption("数量") @column("count")      @note("  ") Integer count;//     
	private @caption("图片") @column("img") @like  @hidden    @note("  ") String img;//     
	private @caption("充") @column("chong")      @note("  ") Integer chong;//     
	private @caption("赠") @column("zeng")      @note("  ") Integer zeng;//     
	private @caption("用户信息") @column("member")      @note("  ") Long member;//     
	private @caption("属性") @column("attribute") @like     @note("  ") String attribute;//     
	private @caption("品牌") @column("brand")      @note("  ") Long brand;//     
	private @caption("选择") @column("select")      @note("  ") String select;//     
	 
	//默认构造函数
	public ShoppingCart(){ 
	
	}
	
	//主键构造函数
	public ShoppingCart(Long id){
		this.id = id;
	}
	
	/**所有字段构造函数 
	 ShoppingCart(
	 	Utils.getLong("goods")//商品信息
	 	,Utils.getString("names")//商品名称
	 	,Utils.getDouble("price")//价格
	 	,Utils.getInteger("count")//数量
	 	,Utils.getString("img")//图片
	 	,Utils.getInteger("chong")//充
	 	,Utils.getInteger("zeng")//赠
	 	,Utils.getLong("member")//用户信息
	 	,Utils.getString("attribute")//属性
	 	,Utils.getLong("brand")//品牌
	 	,Utils.getString("select")//选择
	 )
	**/
	public ShoppingCart(Long goods,String names,Double price,Integer count,String img,Integer chong,Integer zeng,Long member,String attribute,Long brand,String select){
		this.goods=goods;
		this.names=names;
		this.price=price;
		this.count=count;
		this.img=img;
		this.chong=chong;
		this.zeng=zeng;
		this.member=member;
		this.attribute=attribute;
		this.brand=brand;
		this.select=select;
	}
	
	//设置非空字段
	public ShoppingCart setNotNull(){
		return this;
	}
	/** 编号 [非空]       **/
	public ShoppingCart id(Long id){
		this.id = id;
		this.setSeted(F.id);
		return this;
	}
	/** 商品信息        **/
	public ShoppingCart goods(Long goods){
		this.goods = goods;
		this.setSeted(F.goods);
		return this;
	}
	/** 商品名称        **/
	public ShoppingCart names(String names){
		this.names = names;
		this.setSeted(F.names);
		return this;
	}
	/** 价格        **/
	public ShoppingCart price(Double price){
		this.price = price;
		this.setSeted(F.price);
		return this;
	}
	/** 数量        **/
	public ShoppingCart count(Integer count){
		this.count = count;
		this.setSeted(F.count);
		return this;
	}
	/** 图片        **/
	public ShoppingCart img(String img){
		this.img = img;
		this.setSeted(F.img);
		return this;
	}
	/** 充        **/
	public ShoppingCart chong(Integer chong){
		this.chong = chong;
		this.setSeted(F.chong);
		return this;
	}
	/** 赠        **/
	public ShoppingCart zeng(Integer zeng){
		this.zeng = zeng;
		this.setSeted(F.zeng);
		return this;
	}
	/** 用户信息        **/
	public ShoppingCart member(Long member){
		this.member = member;
		this.setSeted(F.member);
		return this;
	}
	/** 属性        **/
	public ShoppingCart attribute(String attribute){
		this.attribute = attribute;
		this.setSeted(F.attribute);
		return this;
	}
	/** 品牌        **/
	public ShoppingCart brand(Long brand){
		this.brand = brand;
		this.setSeted(F.brand);
		return this;
	}
	/** 选择        **/
	public ShoppingCart select(String select){
		this.select = select;
		this.setSeted(F.select);
		return this;
	}
	
	
	/**
	* 克隆对象
	**/
	public ShoppingCart clone(){
		ShoppingCart clone = new ShoppingCart();
		clone.goods=this.goods;
		clone.names=this.names;
		clone.price=this.price;
		clone.count=this.count;
		clone.img=this.img;
		clone.chong=this.chong;
		clone.zeng=this.zeng;
		clone.member=this.member;
		clone.attribute=this.attribute;
		clone.brand=this.brand;
		clone.select=this.select;
		return clone;
	}
	
	
	/**
	 * 根据ID取购物车
	 * @param id
	 * @return
	 */
	public static @api ShoppingCart get(Long id){		
		return getShoppingCartById(id);
	}
	
	/**
	 * 获取所有购物车
	 * @return
	 */
	public static @api List<ShoppingCart> list(Map params,Integer size){
		return getShoppingCartList(params,size);
	}
	/**
	 * 获取购物车分页
	 * @return
	 */
	public static @api Page<ShoppingCart> page(Integer page,Integer size,Map params){
		return getShoppingCartPage(page, size , params);
	}
	
	
	/**
	 * 根据查询条件取购物车
	 * @param params
	 * @return
	 */
	public static @api ShoppingCart Get(Map params){
		return getShoppingCart(params);
	}
	/**
	 * 获取购物车数
	 * @return
	 */
	public static @api Long count(Map params){
		return getShoppingCartCount(params);
	}
	/**
	 * 获取购物车数
	 * @return
	 */
	public static @api <T> T eval(String eval,Map params){
		return getShoppingCartEval(eval,params);
	}
	/**
	 * 获取购物车图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> stats(Map params,C sumKey,C groupKey){
		return getShoppingCartStats(params,sumKey,groupKey,-1);
	}
	/**
	 * 获取购物车图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 分组的字段
	 * @param dateType 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> stats(Map params,C sumKey,C groupKey,int dateType){
		return getShoppingCartStats(params,sumKey,groupKey,dateType);
	}
	
	/**
	 * 根据ID取购物车
	 * @param id
	 * @return
	 */
	public static @api ShoppingCart getShoppingCartById(Long id){		
		return getShoppingCartDao().getShoppingCartById(id);
	}
	
	
	/**
	 * 根据ID取购物车的标识键值
	 * @param id
	 * @return
	 */
	public static @api String getKeyValue(Object key){
		Long id = Utils.parseLong(key);	
		if(id==null || id.longValue()==0 ){
			return null;
		}
		String value = null;
		if(value==null){
			ShoppingCart shoppingCart = get(id);
			if(shoppingCart!=null){
				String strValue = shoppingCart.getId$();
				value = strValue;
			}else{
				value = "{"+id+"}";
			}
		}
		/************LAZY3Q_ID_KEYVALUE************/
		/************LAZY3Q_ID_KEYVALUE************/
		return value;
	}	
	
	
	/**
	 * 获取当前对象的键值
	 * @return
	 */
	public String getKeyValue(){
		/************LAZY3Q_CODE_KEYVALUE************/
		/************LAZY3Q_CODE_KEYVALUE************/
		String keyValue = this.getId$();
		return keyValue;
	}
	
	
	/**
	 * 根据关键字精确查询购物车对象
	 * @return
	 */
	public static @api ShoppingCart find(String key){
		if(Utils.empty(key))return null;
		Map params = new HashMap();
		if(key.toLowerCase().startsWith("id:"))//如果查询条件以id:开头，则按ID查询
			params.put("id", key.toLowerCase().replaceFirst("id:", ""));					
		else{//按标识查询，精确查询
			String strDefinex = "";
			strDefinex="(2=1 "+strDefinex+")";
			params.put("definex",strDefinex);
		}
		/************LAZY3Q_CODE_FIND************/
		/************LAZY3Q_CODE_FIND************/
		return ShoppingCart.getShoppingCart(params);
	}
	
	
	/**
	 * 根据关键字查询购物车
	 * @return
	 */
	public static @api List<Map> query(String key,int size,Map params,Boolean bObject){
		if(Utils.empty((String)params.get("asc")) && Utils.empty((String)params.get("desc")))//如果未传入排序字段
			params.put("desc","id");//那么，默认以主键降序，传给Dao层
		String strTerm=key;		
		if(!Utils.empty(strTerm)){
			if(strTerm.toLowerCase().startsWith("id:"))//如果查询条件以id:开头，则按ID查询
				params.put("id", strTerm.toLowerCase().replaceFirst("id:", ""));					
			else//按标识查询，模糊查询请带%
			{
				String strDefinex = "";
				strDefinex="(2=1 "+strDefinex+")";
				params.put("definex",strDefinex);
			}
		}
		/************LAZY3Q_CODE_QUERY************/
		/************LAZY3Q_CODE_QUERY************/
			
		List<ShoppingCart> list = page(0,size,params).getResult();
		
		/**
		* OK!取到数据拼成放入Map中，[{value,text,object:{...}},...]
		* value:数据ID，text:数据标识,object,整个对象
		**/
		List<Map> result = new java.util.ArrayList();
		for(ShoppingCart shoppingCart:list){
			Map map = new HashMap();
			map.put("key",shoppingCart.getId().toString());
			map.put("value", Utils.js(shoppingCart.getKeyValue()));
			if(bObject==true)
				map.put("object",shoppingCart);
			result.add(map);
		}
		/************LAZY3Q_AFTER_QUERY************/
		/************LAZY3Q_AFTER_QUERY************/
		
		return result;
	}
	
	
	
	/**
	 * 获取所有购物车
	 * @return
	 */
	public static @api List<ShoppingCart> getShoppingCartList(Map params,Integer size){
		return getShoppingCartDao().getShoppingCartList(params,0,size);
	}
	
	/**
	 * 获取购物车分页
	 * @return
	 */
	public static @api Page<ShoppingCart> getShoppingCartPage(Integer page,Integer size,Map params){
		if(page==null)page=0;
		if(size==null)size=20;
		return getShoppingCartDao().getShoppingCartPage(page, size , params);
	}
	
	/**
	 * 根据查询条件取购物车
	 * @param params
	 * @return
	 */
	public static @api ShoppingCart getShoppingCart(Map params){
		return getShoppingCartDao().getShoppingCart(params);
	}
	
	/**
	 * 保存一个购物车
	 * @param shoppingCart
	 * @return
	 */
	public static @api ShoppingCart saveShoppingCart(ShoppingCart shoppingCart){
		return getShoppingCartDao().saveShoppingCart(shoppingCart);
	}
	
	/**
	 * 根据条件更新购物车
	 * @param values
	 * @param params
	 */
	public static @api int updateShoppingCartByConfirm(Map values, Map params){
		return getShoppingCartDao().updateShoppingCartByConfirm(values,params);
	}
	
	/**
	 * 修改一个购物车
	 * @param shoppingCart
	 * @return
	 */
	public static @api int updateShoppingCart(ShoppingCart shoppingCart){
		return getShoppingCartDao().updateShoppingCart(shoppingCart);
	}
	
	/**
	 * 更新购物车非空字段
	 * @param shoppingCart
	 */
	public static @api int updateShoppingCart$NotNull(ShoppingCart shoppingCart){
		return getShoppingCartDao().updateShoppingCart$NotNull(shoppingCart);
	}
	
	/**
	 * 获取购物车数
	 * @return
	 */
	public static @api Long getShoppingCartCount(Map params){
		return getShoppingCartDao().getShoppingCartCount(params);
	}
		
		
	/**
	 * 获取购物车自定义求和表达式,比如求和:eval="sum(id)"
	 * @return
	 */	
	public static @api <T> T getShoppingCartEval(String eval,Map params){
		return getShoppingCartDao().getShoppingCartEval(eval,params);
	}
	/**
	 * 获取购物车图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 分组的字段
	 * @param dateType 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> getShoppingCartStats(Map params,C sumKey,C groupKey,int dateType){
		//TODO:图表统计功能未实现
		
		Map<String,Object> groups=new HashMap();//要分组的字段
		Map<String,Object> sums=new HashMap();//要统计的字段
		
		String[][] dateFormats=new String[][]{
				null,
				new String[]{"%Y","yyyy年","Y"},
				new String[]{"%Y-%m","yyyy年MM月","M"},
				new String[]{"%Y%U","yyyy年第ww周","W"},
				new String[]{"%Y-%m-%d","yyyy年MM月dd日","D"},
				new String[]{"%Y-%m-%d %H","yyyy年MM月dd日 HH点","H"},
				new String[]{"%m","MM月"},
				new String[]{"%d","dd号"},
				new String[]{"%H","HH点"} 
		};
		
		//获取要分组的字段，放入Map中
		if(dateType>0){
			groups.put(groupKey.toString(),"DATE_FORMAT({key},'"+dateFormats[dateType][0]+"')");
		}else{
			groups.put(groupKey.toString(),"{key}");
		}
		if(dateType<6 && dateType>0){ 
			params.put("asc", groupKey.toString()); 
			if(params.get(groupKey.name()+"Start")==null){
				params.put(groupKey.name()+"Start", Utils.date(new Date(), -24, dateFormats[dateType][2]));
			}
		}
		
		
		//获取要统计的字段，放入Map中
		if(sumKey.toString().equals("count")){
			sums.put(sumKey.toString(),"count(*)");
		}else{
			sums.put(sumKey.toString(),"sum({key})");
		}
		
		List<Map> list = getShoppingCartDao().getShoppingCartStats(params,groups,sums);
		
		List<Map> result = new ArrayList();
		for(Map m:list){
			Map map = new HashMap();
			Object value = m.get(sumKey.toString());
			Object name = null;
			Object groupValue = m.get(groupKey.toString());
			if(dateType>0){
				name = Utils.date(Utils.parseDate(groupValue), dateFormats[dateType][1]);
			}else{
				try{
					java.lang.reflect.Method method = ShoppingCart.class.getMethod("get"+Utils.ForMat(groupKey.toString())+"$");
					method.setAccessible(true);
					name = method.invoke(ShoppingCart.fromMap(m));
				}catch(Exception ex){
					ex.printStackTrace();
				}
			}
			map.put("name", name);
			map.put("value", value);
			result.add(map);
		}
		return result;
	}
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static int updateShoppingCart(Map set,Map where){
		if(set.isEmpty())throw new RuntimeException("set为空");
		if(where.isEmpty())throw new RuntimeException("where为空");
		where.put("confirm", "1");
		return getShoppingCartDao().updateShoppingCartByConfirm(set, where);
	}
	
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static void deleteShoppingCart(Map where){
		if(where.isEmpty())throw new RuntimeException("where为空");
		where.put("confirm", "1");
		getShoppingCartDao().deleteShoppingCartByConfirm(where);
	}
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static void delete(Long id){
		if(id==null)throw new RuntimeException("id为空");
		getShoppingCartDao().deleteShoppingCartById(id);
	}
	
	
	/**
	 * 保存购物车对象
	 * @param params
	 * @return
	 */
	public ShoppingCart save(){
		if(this.getId()!=null)
			getShoppingCartDao().updateShoppingCart(this);
		else
			return getShoppingCartDao().saveShoppingCart(this);
		return this;
	}
	
	
	/**
	 * 更新购物车对象的非空字段,注意跟Service里面的update不一样哦
	 * @param params
	 * @return
	 */
	public int update(){
		return getShoppingCartDao().updateShoppingCart$NotNull(this);
	}
	
	
	/**
	 * 删除
	 * @param params
	 * @return
	 */
	public void delete(){
			getShoppingCartDao().deleteShoppingCartById(this.getId());
	}
	
	/**
	 * 执行事务
	 * @param function
	 */
	public static <T> T execute(Function function){
		return getShoppingCartDao().executeTransaction(function);
	}
	/*******************************编号**********************************/	
	/**
	* 编号 [非空]      
	**/
	public Long getId(){
		if(this.id!=null){
			return this.id;
		}
		return this.id;
	}
	/**
	* 获取编号格式化(toString)
	**/
	public String getId$(){
		String strValue="";
		 strValue=Utils.string(this.getId());
	 	 return strValue;
	}
	/**
	* 根据编号反格式化
	**/
	public void setId$(String strValue){
		if(Utils.empty(strValue)){
			this.id=null;
			return;
		}
	 	this.id=Utils.parseLong(strValue);
	}
	
	/**
	* 编号 [非空]      
	**/
	public void setId(Long id){
		this.id = id;
		this.setSeted(F.id);
	}
	
	
	
	
	/*******************************商品信息**********************************/	
	/**
	* 商品信息       
	**/
	public Long getGoods(){
		if(this.goods!=null){
			return this.goods;
		}
		return this.goods;
	}
	/**
	* 获取商品信息格式化(toString)
	**/
	public String getGoods$(){
		String strValue="";
		 strValue=Utils.string(this.getGoods());
	 	 return strValue;
	}
	/**
	* 根据商品信息反格式化
	**/
	public void setGoods$(String strValue){
		if(Utils.empty(strValue)){
			this.goods=null;
			return;
		}
	 	this.goods=Utils.parseLong(strValue);
	}
	
	/**
	* 商品信息       
	**/
	public void setGoods(Long goods){
		this.goods = goods;
		this.setSeted(F.goods);
	}
	
	
	
	
	/*******************************商品名称**********************************/	
	/**
	* 商品名称       
	**/
	public String getNames(){
		if(this.names!=null){
			return this.names;
		}
		return this.names;
	}
	/**
	* 获取商品名称格式化(toString)
	**/
	public String getNames$(){
		String strValue="";
		 strValue=Utils.string(this.getNames());
	 	 return strValue;
	}
	/**
	* 根据商品名称反格式化
	**/
	public void setNames$(String strValue){
		if(Utils.empty(strValue)){
			this.names=null;
			return;
		}
	 	this.names=strValue;
	}
	
	/**
	* 商品名称       
	**/
	public void setNames(String names){
		this.names = names;
		this.setSeted(F.names);
	}
	
	
	
	
	/*******************************价格**********************************/	
	/**
	* 价格       
	**/
	public Double getPrice(){
		if(this.price!=null){
			return this.price;
		}
		return this.price;
	}
	/**
	* 获取价格格式化(toString)
	**/
	public String getPrice$(){
		String strValue="";
		 strValue=Utils.string(this.getPrice());	
	 	 return strValue;
	}
	/**
	* 根据价格反格式化
	**/
	public void setPrice$(String strValue){
		if(Utils.empty(strValue)){
			this.price=null;
			return;
		}
	 	this.price=Utils.parseDouble(strValue);
	}
	
	/**
	* 价格       
	**/
	public void setPrice(Double price){
		this.price = price;
		this.setSeted(F.price);
	}
	
	
	
	
	/*******************************数量**********************************/	
	/**
	* 数量       
	**/
	public Integer getCount(){
		if(this.count!=null){
			return this.count;
		}
		return this.count;
	}
	/**
	* 获取数量格式化(toString)
	**/
	public String getCount$(){
		String strValue="";
		 strValue=Utils.string(this.getCount());
	 	 return strValue;
	}
	/**
	* 根据数量反格式化
	**/
	public void setCount$(String strValue){
		if(Utils.empty(strValue)){
			this.count=null;
			return;
		}
	 	this.count=Utils.parseInteger(strValue);
	}
	
	/**
	* 数量       
	**/
	public void setCount(Integer count){
		this.count = count;
		this.setSeted(F.count);
	}
	
	
	
	
	/*******************************图片**********************************/	
	/**
	* 图片       
	**/
	public String getImg(){
		if(this.img!=null){
			return this.img;
		}
		return this.img;
	}
	/**
	* 获取图片格式化(toString)
	**/
	public String getImg$(){
		String strValue="";
		 strValue=Utils.string(this.getImg());
	 	 return strValue;
	}
	/**
	* 根据图片反格式化
	**/
	public void setImg$(String strValue){
		if(Utils.empty(strValue)){
			this.img=null;
			return;
		}
	 	this.img=strValue;
	}
	
	/**
	* 图片       
	**/
	public void setImg(String img){
		this.img = img;
		this.setSeted(F.img);
	}
	
	
	
	
	/*******************************充**********************************/	
	/**
	* 充       
	**/
	public Integer getChong(){
		if(this.chong!=null){
			return this.chong;
		}
		return this.chong;
	}
	/**
	* 获取充格式化(toString)
	**/
	public String getChong$(){
		String strValue="";
		 strValue=Utils.string(this.getChong());
	 	 return strValue;
	}
	/**
	* 根据充反格式化
	**/
	public void setChong$(String strValue){
		if(Utils.empty(strValue)){
			this.chong=null;
			return;
		}
	 	this.chong=Utils.parseInteger(strValue);
	}
	
	/**
	* 充       
	**/
	public void setChong(Integer chong){
		this.chong = chong;
		this.setSeted(F.chong);
	}
	
	
	
	
	/*******************************赠**********************************/	
	/**
	* 赠       
	**/
	public Integer getZeng(){
		if(this.zeng!=null){
			return this.zeng;
		}
		return this.zeng;
	}
	/**
	* 获取赠格式化(toString)
	**/
	public String getZeng$(){
		String strValue="";
		 strValue=Utils.string(this.getZeng());
	 	 return strValue;
	}
	/**
	* 根据赠反格式化
	**/
	public void setZeng$(String strValue){
		if(Utils.empty(strValue)){
			this.zeng=null;
			return;
		}
	 	this.zeng=Utils.parseInteger(strValue);
	}
	
	/**
	* 赠       
	**/
	public void setZeng(Integer zeng){
		this.zeng = zeng;
		this.setSeted(F.zeng);
	}
	
	
	
	
	/*******************************用户信息**********************************/	
	/**
	* 用户信息       
	**/
	public Long getMember(){
		if(this.member!=null){
			return this.member;
		}
		return this.member;
	}
	/**
	* 获取用户信息格式化(toString)
	**/
	public String getMember$(){
		String strValue="";
		 strValue=Utils.string(this.getMember());
	 	 return strValue;
	}
	/**
	* 根据用户信息反格式化
	**/
	public void setMember$(String strValue){
		if(Utils.empty(strValue)){
			this.member=null;
			return;
		}
	 	this.member=Utils.parseLong(strValue);
	}
	
	/**
	* 用户信息       
	**/
	public void setMember(Long member){
		this.member = member;
		this.setSeted(F.member);
	}
	
	
	
	
	/*******************************属性**********************************/	
	/**
	* 属性       
	**/
	public String getAttribute(){
		if(this.attribute!=null){
			return this.attribute;
		}
		return this.attribute;
	}
	/**
	* 获取属性格式化(toString)
	**/
	public String getAttribute$(){
		String strValue="";
		 strValue=Utils.string(this.getAttribute());
	 	 return strValue;
	}
	/**
	* 根据属性反格式化
	**/
	public void setAttribute$(String strValue){
		if(Utils.empty(strValue)){
			this.attribute=null;
			return;
		}
	 	this.attribute=strValue;
	}
	
	/**
	* 属性       
	**/
	public void setAttribute(String attribute){
		this.attribute = attribute;
		this.setSeted(F.attribute);
	}
	
	
	
	
	/*******************************品牌**********************************/	
	/**
	* 品牌       
	**/
	public Long getBrand(){
		if(this.brand!=null){
			return this.brand;
		}
		return this.brand;
	}
	/**
	* 获取品牌格式化(toString)
	**/
	public String getBrand$(){
		String strValue="";
		 strValue=Utils.string(this.getBrand());
	 	 return strValue;
	}
	/**
	* 根据品牌反格式化
	**/
	public void setBrand$(String strValue){
		if(Utils.empty(strValue)){
			this.brand=null;
			return;
		}
	 	this.brand=Utils.parseLong(strValue);
	}
	
	/**
	* 品牌       
	**/
	public void setBrand(Long brand){
		this.brand = brand;
		this.setSeted(F.brand);
	}
	
	
	
	
	/*******************************选择**********************************/	
	/**
	* 选择       
	**/
	public String getSelect(){
		if(this.select!=null){
			return this.select;
		}
		return this.select;
	}
	/**
	* 获取选择格式化(toString)
	**/
	public String getSelect$(){
		String strValue="";
		 strValue=Utils.string(this.getSelect());
	 	 return strValue;
	}
	/**
	* 根据选择反格式化
	**/
	public void setSelect$(String strValue){
		if(Utils.empty(strValue)){
			this.select=null;
			return;
		}
	 	this.select=strValue;
	}
	
	/**
	* 选择       
	**/
	public void setSelect(String select){
		this.select = select;
		this.setSeted(F.select);
	}
	
	
	
	
	/************LAZY3Q_DEFINE_CODE************/
	/************LAZY3Q_DEFINE_CODE************/
	
	
	/**
	 * 触发器
	 */
	public static void on(Trigger.Index index,final Notify.Listener listener,Trigger.Type... types){
		Notify.on(ShoppingCart.class, index, listener, types);
	}
	public static void on(final Notify.Listener listener,String type){
		Notify.on(ShoppingCart.class, listener, type);
	}
	/**
	 * 当修改字段时
	 * @param filedName
	 * @param listener
	 */
	public static void on(String filedName,final Notify.Listener listener){
		Notify.on(ShoppingCart.class, listener, filedName);
	}
	/**
	 * 当修改字段为某值时
	 * @param filedName
	 * @param value
	 * @param listener
	 */
	public static void on(String filedName,Object value,final Notify.Listener listener){
		if(value==null)return;
		Notify.on(ShoppingCart.class, listener, filedName+"."+Utils.md5(""+value));
	}
	public void notify(String type){
		Trigger.on(ShoppingCart.class,type, this);
	}
	
	
	/**
	 * 用来获取当有字段关联对象时的获取方式,调用如${ShoppingCart.obj.filedName}
	 * 因为有些变态的模板语言不能识别$，所以不能以${ShoppingCart.$filedName}获取关联对象
	 */
	public Map getObj(){
		return new HashMap(){
			@Override
			public Object get(Object key) {
				try {
					return ShoppingCart.class.getMethod("get$"+Utils.forMat(key.toString())).invoke(ShoppingCart.this);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return null;
			}
		};
	}
	/**
	 * 用来获取某字段格式化的获取方式,调用如${ShoppingCart.fmt.filedName}
	 * 因为有些变态的模板语言不能识别$，所以不能以${ShoppingCart.filedName$}获取某字段格式化
	 */
	public Map getFmt(){
		return new HashMap(){
			@Override
			public Object get(Object key) {
				try {
					return ShoppingCart.class.getMethod("get"+Utils.ForMat(key.toString()+"$")).invoke(ShoppingCart.this);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return null;
			}
		};
	}
	/**
	 * 获取查询参数链式串
	 * @return
	 */
	public static @Deprecated M where(){ return new M(0); }
	public static @Deprecated M m(){ return new M(0); }
	public static M where = new M(0,true);
	public static @database(DatabaseNames.distribute_sys) class M extends IbatisMap{
		int type = 0; 
		M linked = null;
		Boolean proxy = false;
		public M set = null;
		public M(int type){
			this.type = type;
			if(this.type==0){
				set = new M(1,true);
				set.linked = this;
			}
		};
		public M(int type,Boolean proxy){
			this.type = type;
			this.proxy=proxy;
		};
		public M proxy(){
			M m = new M(this.type);//当前的对像
			if(this.type==0){
				m.set = new M(1,true);//set对象
				m.set.linked = m;
			}else{
				m.linked=this.linked;
				this.linked.linked=m;
			}
			return m;
		}
		public @Deprecated M set(){			
			M m = this;
			m.linked=new M(1);
			m.linked.linked=m;
			return m.linked;
		};
		public M on(IbatisMap value,C column,String joinColumn){if(proxy)return proxy().on(value,column,joinColumn);this.put(value.getClass().getDeclaringClass().getSimpleName(), value);value.put("on", column.toString());value.put("to", joinColumn);return this;};
		/** 编号 [非空]       **/
		public M id(Object id){if(proxy)return proxy().id(id);  this.put("id", id);return this;};
	 	/** and id is null */
 		public M idNull(){if(proxy)return proxy().idNull();if(this.get("idNot")==null)this.put("idNot", "");this.put("id", null);return this;};
 		/** not .... */
 		public M idNot(){if(proxy)return proxy().idNot();this.put("idNot", "not");return this;};
 		public M idNotNull(){if(proxy)return proxy().idNotNull();this.put("idNot", "not");this.put("id", null);return this;};
 		public M idNot(Object id){if(proxy)return proxy().idNot(id);this.put("idNot", "not");this.put("id", id);return this;};
		/** and id <= ? */
		public M idMin(Object min){if(proxy)return proxy().idMin(min);this.put("idMin", min);return this;};
		/** and id >= ? */
		public M idMax(Object max){if(proxy)return proxy().idMax(max);this.put("idMax", max);return this;};
		public M idIn(String ids){
			if(proxy)return proxy().idIn(ids);  this.put("idIn", ids);return this;
		};	
		/** 商品信息        **/
		public M goods(Object goods){if(proxy)return proxy().goods(goods);  this.put("goods", goods);return this;};
	 	/** and goods is null */
 		public M goodsNull(){if(proxy)return proxy().goodsNull();if(this.get("goodsNot")==null)this.put("goodsNot", "");this.put("goods", null);return this;};
 		/** not .... */
 		public M goodsNot(){if(proxy)return proxy().goodsNot();this.put("goodsNot", "not");return this;};
 		public M goodsNotNull(){if(proxy)return proxy().goodsNotNull();this.put("goodsNot", "not");this.put("goods", null);return this;};
 		public M goodsNot(Object goods){if(proxy)return proxy().goodsNot(goods);this.put("goodsNot", "not");this.put("goods", goods);return this;};
		/** and goods <= ? */
		public M goodsMin(Object min){if(proxy)return proxy().goodsMin(min);this.put("goodsMin", min);return this;};
		/** and goods >= ? */
		public M goodsMax(Object max){if(proxy)return proxy().goodsMax(max);this.put("goodsMax", max);return this;};
		public M goodsIn(String ids){
			if(proxy)return proxy().goodsIn(ids);  this.put("goodsIn", ids);return this;
		};	
		/** 商品名称        **/
		public M names(Object names){if(proxy)return proxy().names(names);  this.put("names", names);return this;};
	 	/** and names is null */
 		public M namesNull(){if(proxy)return proxy().namesNull();if(this.get("namesNot")==null)this.put("namesNot", "");this.put("names", null);return this;};
 		/** not .... */
 		public M namesNot(){if(proxy)return proxy().namesNot();this.put("namesNot", "not");return this;};
 		public M namesNotNull(){if(proxy)return proxy().namesNotNull();this.put("namesNot", "not");this.put("names", null);return this;};
 		public M namesNot(Object names){if(proxy)return proxy().namesNot(names);this.put("namesNot", "not");this.put("names", names);return this;};
		/** 价格        **/
		public M price(Object price){if(proxy)return proxy().price(price);  this.put("price", price);return this;};
	 	/** and price is null */
 		public M priceNull(){if(proxy)return proxy().priceNull();if(this.get("priceNot")==null)this.put("priceNot", "");this.put("price", null);return this;};
 		/** not .... */
 		public M priceNot(){if(proxy)return proxy().priceNot();this.put("priceNot", "not");return this;};
 		public M priceNotNull(){if(proxy)return proxy().priceNotNull();this.put("priceNot", "not");this.put("price", null);return this;};
 		public M priceNot(Object price){if(proxy)return proxy().priceNot(price);this.put("priceNot", "not");this.put("price", price);return this;};
		/** and price <= ? */
		public M priceMin(Object min){if(proxy)return proxy().priceMin(min);this.put("priceMin", min);return this;};
		/** and price >= ? */
		public M priceMax(Object max){if(proxy)return proxy().priceMax(max);this.put("priceMax", max);return this;};
		/** 数量        **/
		public M count(Object count){if(proxy)return proxy().count(count);  this.put("count", count);return this;};
	 	/** and count is null */
 		public M countNull(){if(proxy)return proxy().countNull();if(this.get("countNot")==null)this.put("countNot", "");this.put("count", null);return this;};
 		/** not .... */
 		public M countNot(){if(proxy)return proxy().countNot();this.put("countNot", "not");return this;};
 		public M countNotNull(){if(proxy)return proxy().countNotNull();this.put("countNot", "not");this.put("count", null);return this;};
 		public M countNot(Object count){if(proxy)return proxy().countNot(count);this.put("countNot", "not");this.put("count", count);return this;};
		/** and count <= ? */
		public M countMin(Object min){if(proxy)return proxy().countMin(min);this.put("countMin", min);return this;};
		/** and count >= ? */
		public M countMax(Object max){if(proxy)return proxy().countMax(max);this.put("countMax", max);return this;};
		public M countIn(String ids){
			if(proxy)return proxy().countIn(ids);  this.put("countIn", ids);return this;
		};	
		/** 图片        **/
		public M img(Object img){if(proxy)return proxy().img(img);  this.put("img", img);return this;};
	 	/** and img is null */
 		public M imgNull(){if(proxy)return proxy().imgNull();if(this.get("imgNot")==null)this.put("imgNot", "");this.put("img", null);return this;};
 		/** not .... */
 		public M imgNot(){if(proxy)return proxy().imgNot();this.put("imgNot", "not");return this;};
 		public M imgNotNull(){if(proxy)return proxy().imgNotNull();this.put("imgNot", "not");this.put("img", null);return this;};
 		public M imgNot(Object img){if(proxy)return proxy().imgNot(img);this.put("imgNot", "not");this.put("img", img);return this;};
		/** 充        **/
		public M chong(Object chong){if(proxy)return proxy().chong(chong);  this.put("chong", chong);return this;};
	 	/** and chong is null */
 		public M chongNull(){if(proxy)return proxy().chongNull();if(this.get("chongNot")==null)this.put("chongNot", "");this.put("chong", null);return this;};
 		/** not .... */
 		public M chongNot(){if(proxy)return proxy().chongNot();this.put("chongNot", "not");return this;};
 		public M chongNotNull(){if(proxy)return proxy().chongNotNull();this.put("chongNot", "not");this.put("chong", null);return this;};
 		public M chongNot(Object chong){if(proxy)return proxy().chongNot(chong);this.put("chongNot", "not");this.put("chong", chong);return this;};
		/** and chong <= ? */
		public M chongMin(Object min){if(proxy)return proxy().chongMin(min);this.put("chongMin", min);return this;};
		/** and chong >= ? */
		public M chongMax(Object max){if(proxy)return proxy().chongMax(max);this.put("chongMax", max);return this;};
		public M chongIn(String ids){
			if(proxy)return proxy().chongIn(ids);  this.put("chongIn", ids);return this;
		};	
		/** 赠        **/
		public M zeng(Object zeng){if(proxy)return proxy().zeng(zeng);  this.put("zeng", zeng);return this;};
	 	/** and zeng is null */
 		public M zengNull(){if(proxy)return proxy().zengNull();if(this.get("zengNot")==null)this.put("zengNot", "");this.put("zeng", null);return this;};
 		/** not .... */
 		public M zengNot(){if(proxy)return proxy().zengNot();this.put("zengNot", "not");return this;};
 		public M zengNotNull(){if(proxy)return proxy().zengNotNull();this.put("zengNot", "not");this.put("zeng", null);return this;};
 		public M zengNot(Object zeng){if(proxy)return proxy().zengNot(zeng);this.put("zengNot", "not");this.put("zeng", zeng);return this;};
		/** and zeng <= ? */
		public M zengMin(Object min){if(proxy)return proxy().zengMin(min);this.put("zengMin", min);return this;};
		/** and zeng >= ? */
		public M zengMax(Object max){if(proxy)return proxy().zengMax(max);this.put("zengMax", max);return this;};
		public M zengIn(String ids){
			if(proxy)return proxy().zengIn(ids);  this.put("zengIn", ids);return this;
		};	
		/** 用户信息        **/
		public M member(Object member){if(proxy)return proxy().member(member);  this.put("member", member);return this;};
	 	/** and member is null */
 		public M memberNull(){if(proxy)return proxy().memberNull();if(this.get("memberNot")==null)this.put("memberNot", "");this.put("member", null);return this;};
 		/** not .... */
 		public M memberNot(){if(proxy)return proxy().memberNot();this.put("memberNot", "not");return this;};
 		public M memberNotNull(){if(proxy)return proxy().memberNotNull();this.put("memberNot", "not");this.put("member", null);return this;};
 		public M memberNot(Object member){if(proxy)return proxy().memberNot(member);this.put("memberNot", "not");this.put("member", member);return this;};
		/** and member <= ? */
		public M memberMin(Object min){if(proxy)return proxy().memberMin(min);this.put("memberMin", min);return this;};
		/** and member >= ? */
		public M memberMax(Object max){if(proxy)return proxy().memberMax(max);this.put("memberMax", max);return this;};
		public M memberIn(String ids){
			if(proxy)return proxy().memberIn(ids);  this.put("memberIn", ids);return this;
		};	
		/** 属性        **/
		public M attribute(Object attribute){if(proxy)return proxy().attribute(attribute);  this.put("attribute", attribute);return this;};
	 	/** and attribute is null */
 		public M attributeNull(){if(proxy)return proxy().attributeNull();if(this.get("attributeNot")==null)this.put("attributeNot", "");this.put("attribute", null);return this;};
 		/** not .... */
 		public M attributeNot(){if(proxy)return proxy().attributeNot();this.put("attributeNot", "not");return this;};
 		public M attributeNotNull(){if(proxy)return proxy().attributeNotNull();this.put("attributeNot", "not");this.put("attribute", null);return this;};
 		public M attributeNot(Object attribute){if(proxy)return proxy().attributeNot(attribute);this.put("attributeNot", "not");this.put("attribute", attribute);return this;};
		/** 品牌        **/
		public M brand(Object brand){if(proxy)return proxy().brand(brand);  this.put("brand", brand);return this;};
	 	/** and brand is null */
 		public M brandNull(){if(proxy)return proxy().brandNull();if(this.get("brandNot")==null)this.put("brandNot", "");this.put("brand", null);return this;};
 		/** not .... */
 		public M brandNot(){if(proxy)return proxy().brandNot();this.put("brandNot", "not");return this;};
 		public M brandNotNull(){if(proxy)return proxy().brandNotNull();this.put("brandNot", "not");this.put("brand", null);return this;};
 		public M brandNot(Object brand){if(proxy)return proxy().brandNot(brand);this.put("brandNot", "not");this.put("brand", brand);return this;};
		/** and brand <= ? */
		public M brandMin(Object min){if(proxy)return proxy().brandMin(min);this.put("brandMin", min);return this;};
		/** and brand >= ? */
		public M brandMax(Object max){if(proxy)return proxy().brandMax(max);this.put("brandMax", max);return this;};
		public M brandIn(String ids){
			if(proxy)return proxy().brandIn(ids);  this.put("brandIn", ids);return this;
		};	
		/** 选择        **/
		public M select(Object select){if(proxy)return proxy().select(select);  this.put("select", select);return this;};
	 	/** and select is null */
 		public M selectNull(){if(proxy)return proxy().selectNull();if(this.get("selectNot")==null)this.put("selectNot", "");this.put("select", null);return this;};
 		/** not .... */
 		public M selectNot(){if(proxy)return proxy().selectNot();this.put("selectNot", "not");return this;};
 		public M selectNotNull(){if(proxy)return proxy().selectNotNull();this.put("selectNot", "not");this.put("select", null);return this;};
 		public M selectNot(Object select){if(proxy)return proxy().selectNot(select);this.put("selectNot", "not");this.put("select", select);return this;};
	 	public M add(String key, Object value) {if(proxy)return proxy().add(key,value);this.put(key, value);return this;}
	 	public M add(F key, Object value) {if(proxy)return proxy().add(key,value);this.put(key.toString(), value);return this;}
	 	public M desc(C key) {if(proxy)return proxy().desc(key);this.put("desc", key.column);return this;}
	 	public M asc(C key) {if(proxy)return proxy().asc(key);this.put("asc", key.column);return this;}
	 	public M desc(String sql) {if(proxy)return proxy().desc(sql);this.put("desc", sql);return this;}
	 	public M asc(String sql) {if(proxy)return proxy().asc(sql);this.put("asc", sql);return this;}
	 	public M definex(String sql) {if(proxy)return proxy().definex(sql);this.put("definex", sql);return this;}
	 	/** 获取所有购物车 **/
		public @api List<ShoppingCart> list(Integer size){			
			return getShoppingCartList(this,size);
		}
		/** 获取购物车分页 **/
		public @api Page<ShoppingCart> page(Integer page,Integer size){			
			return getShoppingCartPage(page, size , this);
		}
		/** 根据查询条件取购物车 **/
		public @api ShoppingCart get(){			
			return getShoppingCart(this);
		}
		/** 获取购物车数 **/
		public @api Long count(){			
			return getShoppingCartCount(this);
		}
		/** 获取购物车表达式 **/
		public @api <T> T eval(String strEval){			
			return getShoppingCartEval(strEval,this);
		}
		/** 获取购物车统计 **/
		public @api List<Map> stats(C sumKey,C groupKey,int dateType){			
			return getShoppingCartStats(this,sumKey,groupKey,dateType);
		}
		/** 获取购物车统计 **/
		public @api List<Map> stats(C sumKey,C groupKey){			
			return getShoppingCartStats(this,sumKey,groupKey,-1);
		}
		/** 根据条件更新 **/
		public @api int update(){			
			M where = null;
			M set = null;
			if(this.type==0){
				if(this.linked==null)throw new RuntimeException("未发set");
				where = this;
				set = this.linked;
			}else{
				if(this.linked==null)throw new RuntimeException("未发where条件");
				set = this;
				where = this.linked;
			}
			return updateShoppingCart(set,where);
		}
		/** 根据条件删除 **/
		public @api void delete(){			
			deleteShoppingCart(this);
		}
	}
	
	public static class Param extends M{
		public Param(int type) {
			super(type);
		}
		public Param(int type, Boolean proxy) {
			super(type, proxy);
		}
	}
	
	/** 对象的字段描述 **/
	public static class F{
		/** 编号 [非空]       **/
		public final static @type(Long.class)  String id="id";
		/** 商品信息        **/
		public final static @type(Long.class)  String goods="goods";
		/** and goods >= ? */
		public final static @type(Long.class) String goodsMin="goodsMin";
		/** and goods <= ? */
		public final static @type(Long.class) String goodsMax="goodsMax";
		/** 商品名称        **/
		public final static @type(String.class)  String names="names";
		/** 价格        **/
		public final static @type(Double.class)  String price="price";
		/** and price >= ? */
		public final static @type(Double.class) String priceMin="priceMin";
		/** and price <= ? */
		public final static @type(Double.class) String priceMax="priceMax";
		/** 数量        **/
		public final static @type(Integer.class)  String count="count";
		/** and count >= ? */
		public final static @type(Integer.class) String countMin="countMin";
		/** and count <= ? */
		public final static @type(Integer.class) String countMax="countMax";
		/** 图片        **/
		public final static @type(String.class) @like String img="img";
		/** 充        **/
		public final static @type(Integer.class)  String chong="chong";
		/** and chong >= ? */
		public final static @type(Integer.class) String chongMin="chongMin";
		/** and chong <= ? */
		public final static @type(Integer.class) String chongMax="chongMax";
		/** 赠        **/
		public final static @type(Integer.class)  String zeng="zeng";
		/** and zeng >= ? */
		public final static @type(Integer.class) String zengMin="zengMin";
		/** and zeng <= ? */
		public final static @type(Integer.class) String zengMax="zengMax";
		/** 用户信息        **/
		public final static @type(Long.class)  String member="member";
		/** and member >= ? */
		public final static @type(Long.class) String memberMin="memberMin";
		/** and member <= ? */
		public final static @type(Long.class) String memberMax="memberMax";
		/** 属性        **/
		public final static @type(String.class) @like String attribute="attribute";
		/** 品牌        **/
		public final static @type(Long.class)  String brand="brand";
		/** and brand >= ? */
		public final static @type(Long.class) String brandMin="brandMin";
		/** and brand <= ? */
		public final static @type(Long.class) String brandMax="brandMax";
		/** 选择        **/
		public final static @type(String.class)  String select="select";
	 	public static String get(String name){
			try {
				Field field = F.class.getField(name);
				if(field!=null)
					return field.get(null).toString();
			} catch (Exception e) {
				//e.printStackTrace();
			}
			return null;
		}
	}
	/** 对象的数据库字段描述 **/
	public static enum C{
		id("id"),
		goods("goods"),
		names("names"),
		price("price"),
		count("count"),
		img("img"),
		chong("chong"),
		zeng("zeng"),
		member("member"),
		attribute("attribute"),
		brand("brand"),
		select("select"),
		;
		String column;
		C(String column){
			this.column = column;
		}
		public String toString(){
			return this.column;
		}
		public static String get(String name){
			try {
				Field field = C.class.getField(name);
				if(field!=null)
					return field.get(null).toString();
			} catch (Exception e) {
				//e.printStackTrace();
			}
			return null;
		}
	}
	
	
	
	/**
	* 获取购物车数据
	**/
	public static Object getData(Object param){
		if(param==null)
			return null;
		Object value = null;
		if(param.getClass()==Long.class)
			value = ShoppingCart.get((Long)param);
		else if(param instanceof java.util.Map){
			java.util.Map params = (Map) param;
			if(params.get("size")==null)
				value = ShoppingCart.getShoppingCart(params);
			else
				value = ShoppingCart.getShoppingCartList(params, (Integer) params.get("size"));
		}else if(param.getClass()==Long.class )
			value =  ShoppingCart.where().id(param).get();
		else if(!Utils.empty(param.toString()))
			value = ShoppingCart.get(Long.valueOf(param.toString()));
		return value;
	}
	
	/**对象转json**/
	public Map toJSON(){
		return toJSON(false);
	}
	public Map toJSON(boolean simple){
		Map map = new HashMap();
		map.put("id",this.getId());
		Utils.fms(map,simple?"":"id",this.getId(),this.getId$());
		Utils.fms(map,simple?"":"goods",this.getGoods(),this.getGoods$());
		Utils.fms(map,simple?"":"names",this.getNames(),this.getNames$());
		Utils.fms(map,simple?"":"price",this.getPrice(),this.getPrice$());
		Utils.fms(map,simple?"":"count",this.getCount(),this.getCount$());
		Utils.fms(map,simple?"":"img",this.getImg(),this.getImg$());
		Utils.fms(map,simple?"":"chong",this.getChong(),this.getChong$());
		Utils.fms(map,simple?"":"zeng",this.getZeng(),this.getZeng$());
		Utils.fms(map,simple?"":"member",this.getMember(),this.getMember$());
		Utils.fms(map,simple?"":"attribute",this.getAttribute(),this.getAttribute$());
		Utils.fms(map,simple?"":"brand",this.getBrand(),this.getBrand$());
		Utils.fms(map,simple?"":"select",this.getSelect(),this.getSelect$());
		if(this.suffix!=null)map.put("suffix", this.suffix);
		/************LAZY3Q_DEFINE_TOJSON************/
		/************LAZY3Q_DEFINE_TOJSON************/
		return map;
	}
	/**对象转map**/
	public Map toMap(){
		Map map = new HashMap();
		map.put("id",this.getId());
		map.put("goods",this.getGoods());
		map.put("names",this.getNames());
		map.put("price",this.getPrice());
		map.put("count",this.getCount());
		map.put("img",this.getImg());
		map.put("chong",this.getChong());
		map.put("zeng",this.getZeng());
		map.put("member",this.getMember());
		map.put("attribute",this.getAttribute());
		map.put("brand",this.getBrand());
		map.put("select",this.getSelect());
		map.put("suffix", this.suffix);
		/************LAZY3Q_DEFINE_TOMAP************/
		/************LAZY3Q_DEFINE_TOMAP************/
		return map;
	}
	/**map转对象**/
	public static ShoppingCart fromMap(Map map){
		ShoppingCart shoppingCart = new ShoppingCart();
		shoppingCart.id = Utils.parseLong(map.get("id"));
		shoppingCart.goods = Utils.parseLong(map.get("goods"));
		shoppingCart.names = Utils.parseString(map.get("names"));
		shoppingCart.price = Utils.parseDouble(map.get("price"));
		shoppingCart.count = Utils.parseInteger(map.get("count"));
		shoppingCart.img = Utils.parseString(map.get("img"));
		shoppingCart.chong = Utils.parseInteger(map.get("chong"));
		shoppingCart.zeng = Utils.parseInteger(map.get("zeng"));
		shoppingCart.member = Utils.parseLong(map.get("member"));
		shoppingCart.attribute = Utils.parseString(map.get("attribute"));
		shoppingCart.brand = Utils.parseLong(map.get("brand"));
		shoppingCart.select = Utils.parseString(map.get("select"));
		return shoppingCart;
	}
	
	
	
	/**字段设置标记队列**/
	private Map<String,Boolean> seted=new HashMap();
	public Boolean getSeted(String key){
		return seted.get(key);
	}
	public void setSeted(String key){
		seted.put(key,true);
	}
	/**同步未set的字段**/
	public void mergeSet(ShoppingCart old){
		Field[] fields = this.getClass().getDeclaredFields();
		try {
			for(Field field:fields){
				String key = field.getName();
				if(seted.get(key)==null && field.getAnnotation(column.class)!=null){
					field.setAccessible(true);
					field.set(this, field.get(old));					
				}
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
	
		
	/**自定义变量存储**/
	private Map values=new HashMap();
	public Map getValues(){
		return values;
	}
	public void setValues(String name,Object value){
		values.put(name,value);
	}
	
	/**分表时的表名后缀**/
	private String suffix;
	public String getSuffix() {
		return suffix;
	}
	public void setSuffix(String suffix) {
		this.suffix = suffix;
	}
	/**获取数据库名称**/
	public static String getDataBaseName(){
		return Utils.config("spring.datasource.distribute_sys.name");
	}
	
	public static String getIcon(){
		return "/images/icons/200882564216312778012.png";
	}
	public static String getIconfont(){
		return "icon-jiarugouwuche";
	}
	public static enum ACT{
		列表,添加,修改,详情
	};
	public static String getUrl(ACT act,ShoppingCart.M params){
		if(params==null)params=new ShoppingCart.M(0);
		params.remove("joins");
		params.remove("definexs");
		params.remove("distinct");
		String strUrl = "/admin/users/shoppingcart.edit.html?";
		if(params.get("id")!=null){
			strUrl+="&id="+Utils.encode(""+params.get("id"),Utils.UTF8);
		}
		if(act==ACT.列表){
			strUrl = "/admin/users/shoppingcart.html?1=1";
		}else if(act==ACT.添加){
			strUrl+="&edittype=insert";
		}else if(act==ACT.修改){
			strUrl+="&edittype=update";
		}else if(act==ACT.详情){
			strUrl+="&edittype=detail";
		}		
		if(params!=null){
			for(Object key:params.keySet()){
				strUrl+="&"+key+"="+Utils.encode(""+params.get(key),Utils.UTF8)+"";
			}
		}
		return strUrl;
	}
	public String getDetailUrl(){
		return this.getUrl(ACT.详情, where.id(this.getId()));
	}
	
	/**
	* 转跳到当前地址
	**/
	public static Protocol redirect(ShoppingCart.ACT act,ShoppingCart.M params){
		Protocol protocol = Protocol.create(true,null,"ACT_REDIRECT");
		protocol.set("url",ShoppingCart.getUrl(act, params));
		return protocol;
	}
	/**
	* 打开一个新的tab页面
	**/
	public static Protocol href(ShoppingCart.ACT act,ShoppingCart.M params){
		Protocol protocol = Protocol.create(true,null,"ACT_HREF");
		protocol.set("url",ShoppingCart.getUrl(act, params));
		protocol.set("title",act.name());
		return protocol;
	}
	/**
	* 显示一个消息框，并且关闭当前的对话框
	**/
	public static Protocol message(String message){
		Protocol protocol = Protocol.create(true,null,"ACT_MESSAGE");
		protocol.set("message",message);
		return protocol;
	}
	
	
	static com.distribute.framework.dao.IShoppingCartDao getShoppingCartDao(){
		return Utils.getBean("shoppingCartDao");
	};
	
}